local skel = fk.CreateSkill({
    name = "sj9__xuenanshou",
    tags = {Skill.Compulsory},
  })
  
  Fk:loadTranslationTable{
    ["sj9__xuenanshou"] = "血难收", -- 体力下限 ×  夷灭 √
    [":sj9__xuenanshou"] = "<b>锁定技</b>，一名角色进入濒死状态时，所有角色依次选择是否令其需要额外的一张【桃】才能脱离之。一名角色受到伤害时，若其体力不大于其本局游戏选择是的次数，此伤害直接令其进入濒死状态。",
  
    ["#sj9__xuenanshou"] = "血难收：你可以令 %dest 需要额外一张【桃】才能脱离濒死",
    ["@sj9__xuenanshou"] = "血难收",
  
    ["$sj9__xuenanshou1"] = "",
    ["$sj9__xuenanshou2"] = "",
  }


  skel:addEffect(fk.EnterDying, {
    priority = 1,
    can_trigger = function(self, event, target, player, data)
      return player:hasSkill(skel.name)
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      local n = 0
      for _, t in ipairs(room:getAlivePlayers()) do
        if room:askToSkillInvoke(t,{
          skill_name = skel.name,
          prompt = "#sj9__xuenanshou::"..target.id,
        }) then
          n = n + 1
          room:addPlayerMark(t,"@sj9__xuenanshou")
        end
      end
      target.hp = target.hp - n
      room:broadcastProperty(target,"hp")
    end,
  })
  
  skel:addEffect(fk.DetermineDamageInflicted, {
    priority = 0.01,
    can_trigger = function(self, event, target, player, data)
      return player:hasSkill(skel.name) and target.hp <= target:getMark("@sj9__xuenanshou") and data.damage < (target.hp + target.shield)
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      target.hp = data.damage
      target.shield = 0
      room:broadcastProperty(target,"hp")
      room:broadcastProperty(target,"shield")
    end,
  })

return skel